<template>
  <div>
    <h2>孙子组件</h2>
    <hr />
    <h3 :style="{ color }">颜色======</h3>
  </div>
</template>
<script lang="ts">
import { defineComponent, inject } from "vue";
export default defineComponent({
  name: "grandSon", //孙子组件
  setup(props, context) {
    const color = inject("color");
    return { color };
  },
});
</script>
